<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">
    <f:view>
	<h:head>
		<p:resources />
		<title>Cadastro de Cliente</title>
	</h:head>
<body>
	
	
	
	<h:form prependId="false" >		
		
		<p:messages id="msgs" showDetail="true"/>
		
		<p:panel header="Dados Pessoal" id="panelDadosPessoais">
			<h:panelGrid columns="2" columnClasses="label, value"
				styleClass="grid">
				<h:outputLabel id="labelNome" for="nome" value="Nome* " />
				<p:inputText id="nome" value="#{clienteBeam.cliente.nmCliente}" 
					required="true"/>

				<h:outputLabel id="labelCpf" for="cpf" value="CPF* " />
				<p:inputMask id="cpf" value="#{clienteBeam.cliente.cpf}"
					mask="999.999.999-99">
					<f:converter converterId="farmaciaweb.com.br.CpfConverter" />					
				</p:inputMask>


				<h:outputLabel id="labelEmail" for="email" value="Email* " />
				<p:inputText id="email" value="#{clienteBeam.cliente.email}" />

				<h:outputLabel id="labelSenha" for="senha" value="Senha* " />
				<p:password id="senha" value="#{clienteBeam.cliente.senha}"
					inline="true" onshow="fadein" onhide="fadeout" />

				<h:outputLabel id="labelConfSenha" for="confSenha"
					value="Confirme a senha* " />
				<p:password id="confSenha" value="#{clienteBeam.confirmacaoSenha}"
					inline="true" onshow="fadein" onhide="fadeout" />

				<h:outputLabel id="labelTelRes" for="telRes"
					value="Telefone residêncial " />
				<p:inputMask id="telRes" value="#{clienteBeam.telRes.numTelefone}"
					mask="(99) 9999-9999">
					<f:converter converterId="farmaciaweb.com.br.TelefoneConverter" />
				</p:inputMask>

				<h:outputLabel id="labelTelCel" for="telCel"
					value="Telefone celular " />
				<p:inputMask id="telCel" value="#{clienteBeam.telCel.numTelefone}"
					mask="(99) 9999-9999" />

				<h:outputLabel id="labelTelCom" for="telCom"
					value="Telefone comercial " />
				<p:inputMask id="telCom" value="#{clienteBeam.telCom.numTelefone}"
					mask="(99) 9999-9999" />
			</h:panelGrid>
		</p:panel>


		<p:panel header="Endereço" id="panelDadosEndereço">
		<h:panelGrid columns="2" columnClasses="label, value" styleClass="grid">
			<h:outputLabel id="labelLogradouro" for="logradouro" value="Logradouro* "/>
			<p:inputText id="logradouro"  value="#{clienteBeam.enderecoEntrega.logradouro}"/>
			
			<h:outputLabel id="labelCidade" for="cidade" value="Cidade* "/>
			<p:inputText id="cidade"  value="#{clienteBeam.enderecoEntrega.cidade}"/>
			
			<h:outputLabel id="labelCep" for="cep" value="CEP* "/>
			<p:inputMask id="cep" value="#{clienteBeam.cep.numCep}" 
				mask="99999-999"> 
		    	<f:converter converterId="farmaciaweb.com.br.CepConverter" />		    
		    </p:inputMask>
		    
				
			<h:outputLabel id="labelEstado" for="estado" value="Estado* "/>
			<h:selectOneMenu id="estado" value="#{clienteBeam.estado.idEstado}">
        		<f:selectItems value="#{estadoBeam.listaSelectItemsEstado}" />
    		</h:selectOneMenu>
			</h:panelGrid>
		</p:panel>
		
		<p:commandButton value="Salvar" ajax="false"
	   			actionListener="#{clienteBeam.salvarCliente}" />	
	   	<p:commandButton action="#{clienteBeam.irParaConsultarCliente}" value="Voltar"
						immediate="true" ajax="false" />   			   
	</h:form>
</body>
</f:view>
</html>

